/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jbeacon.baseutil;

import java.util.Date;
import java.util.UUID;

/**
 * <B>说       明</B>:
 * @author  作  者  名：张日雄 <br>
 *          E-mail ：827935210@qq.com<br>
 * @date    创建时间： 2016-7-14 0:28:36<br>
 * @version 版   本  号：V1.0<br>
 */
public class UUIDUtils {
    
    private static long num=0; 
    
    public static String get32UUID() {
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        return uuid;
    }

    public static synchronized String getUUID(String name) {
        UUID uuid = UUID.nameUUIDFromBytes(name.getBytes());
        String str = uuid.toString();
        String uuidStr = str.replace("-", "");
        return uuidStr;
    }
    
    public static synchronized long getLongId() {
//        String date = DateUtil.getDate2FormatString(new Date(), "yyyyMMddHHmmssS");
//        System.out.println("原始id=" + date);
//        if (num >= 99) {
//            num = 0l;
//        }
//        ++num;
//        if (num < 10) {
//            date = date + 00 + num;
//        } else {
//            date += num;
//        }
//        return Long.valueOf(date);
          return new Date().getTime();
    }    
    
}
